package cn.zz.veggie.model.query;

import java.util.Collection;
import java.util.Objects;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import cn.zz.comm.core.types.query.CommQuery;
import cn.zz.comm.mybaits.types.BaseQuery;
import cn.zz.veggie.model.domain.ShopQuote;

/**
 * 用户报价(QuoteUser)查询器
 *
 * @author zhongq
 * @since 2024-05-22 20:16:42
 */
public class ShopQuoteQuery extends CommQuery<Integer> implements BaseQuery<ShopQuote> {
	public Integer shopId;
	public Integer productId;
	public Collection<Integer> productIds;
	public String productName;

	public static ShopQuoteQuery of(Integer shopId, Integer productId) {
		final ShopQuoteQuery query = new ShopQuoteQuery();
		query.shopId = shopId;
		query.productId = productId;
		return query;
	}

	public static ShopQuoteQuery of(Integer shopId, Collection<Integer> productIds) {
		final ShopQuoteQuery query = new ShopQuoteQuery();
		query.shopId = shopId;
		query.productIds = productIds;
		return query;
	}

	@Override
	public void injectCondition(LambdaQueryWrapper<ShopQuote> queryWrapper) {
		queryWrapper.eq(Objects.nonNull(id), ShopQuote::getId, id);
		queryWrapper.in(Objects.nonNull(ids), ShopQuote::getId, ids);
		queryWrapper.eq(Objects.nonNull(shopId), ShopQuote::getShopId, shopId);
		queryWrapper.eq(Objects.nonNull(productId), ShopQuote::getProductId, productId);
		queryWrapper.in(Objects.nonNull(productIds), ShopQuote::getProductId, productIds);
		queryWrapper.ge(Objects.nonNull(createdAtStart), ShopQuote::getCreatedAt, createdAtStart);
		queryWrapper.lt(Objects.nonNull(createdAtEnd), ShopQuote::getCreatedAt, createdAtEnd);
	}

}